chore(dashboards): Improve number formatting documentation#112410
Open
chore(dashboards): Improve number formatting documentation#112410
Conversation
| - **Rounding**. We often round numbers before rendering them. This saves on UI space, creates better scannability, and more correctly represents reality (not all fractional digits are significant). **Sentry rounds numbers to 3 significant digits in most cases** but uses more (4-5) in contexts where it might be useful. | ||
| - **Trailing Zeroes**. Generally, **Sentry renders numbers with a floating decimal point**. e.g., we render `"1.2"` rather than `"1.20"`. This often creates visual misalignment in tables and Y-axes, and is worth reconsidering. | ||
| - **Multipliers**. Some data types benefit from multipliers, whether by prefix or by unit. e.g., for `integer` values, a multiplier can save a lot of space (`"12,341,000"` vs. `"12.3M"`). The same goes for types with known units like durations (`"431312 bytes"` vs. `"0.411 MiB"`). **Sentry formats numbers using the nearest appropriate multiplier** whenever possible. If the value exceeds the maximum or minumum multiplier (e.g., a duration of >1000 years, or a size of <0.001 bytes) **Sentry uses scientific notation**. | ||
| - **Units**. If data has a known unit, **Sentry _always_ shows the unit alongside the value**. Sentry shows the full unit (e.g., `"milliseconds"`) in expanded contexts like detail panels, and the abbreviated unit in other contexts. |
Member
There was a problem hiding this comment.
[Praise] Yes this in particular is really good to know! I'd never thought of this deeply before. +1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I took a pass at the numbers-and-types documentation I wrote a while back. I replaced the page with a new one, that's more focused and gives more practical explanations of how we approach this. I hope this'll be more useful, since the Dashboards team has been getting more feedback in this area.
There are many TODOs in this document. I'd love for us to come together and close them off by making decisions. However, we don't need to do that right now! I'd be perfectly happy to merge this, and start implementing the guidelines and iterate on them gradually.
Most of this is just documenting existing guidelines. There are some notable additions, like scientific notation.